#!/usr/bin/python
# coding=utf-8

'''
get user's info about system and browser
'''

platform_system = {"NT 6.0":"Windows Vista",\
                   "NT 5.2":"Windows 2003", \
                   "NT 5.1":"Windows XP",   \
                   "NT 5":"Windows 2000",   \
                   "NT 4.9":"Windows ME",   \
                   "NT 4":"Windows NT4",    \
                   "NT 98":"Windows 98",    \
                   "NT 95":"Windows 95",    \
                   "Mac":"Mac",             \
                   "unix":"UNIX",           \
                   "linux":"Linux",         \
                   "SunOS":"SunOS"          \
                   }

platform_browser = {"MSIE 7":"Internet Explorer 7",     \
                    "MSIE 6":"Internet Explorer 6",     \
                    "MSIE 5.5":"Internet Explorer 5.5", \
                    "MSIE 5.0":"Internet Explorer 5.0", \
                    "MSIE 4":"Internet Explorer 4.0",   \
                    "Chrome":"Google Chrome",           \
                    "Firefox/3":"Firefox 3"}


def get_system(agent):
    for v in platform_system:
        if str(agent).find(v) != -1:
            return platform_system[v]
    else:
        return "unknown os"
        
def get_browser(agent):
    for v in platform_browser:
        if str(agent).find(v) != -1:
            return platform_browser[v]
    else:
        return "unknown browser"

#if __name__ == '__main__':
   